from sqlalchemy import Column, Integer, String, Text, ForeignKey
from sqlalchemy.orm import relationship
from .base import Base, TimestampMixin

class Item(Base, TimestampMixin):
    """
    项目模型
    """
    __tablename__ = "items"
    
    id = Column(Integer, primary_key=True, index=True)
    name = Column(String(100), index=True, nullable=False)
    description = Column(Text, nullable=True)
    user_id = Column(Integer, ForeignKey("users.id"))
    
    # 关系
    user = relationship("User", backref="items")
    
    def __repr__(self):
        return f"<Item {self.name}>" 